home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Icon / c / ClickWait < prev    next >
Text File  |  1995-07-08  |  1KB  |  38 lines

  1. #include "DeskLib:Wimp.h"
  2. #include "DeskLib:WimpSWIs.h"
  3. #include "DeskLib:Time.h"
  4. #include "DeskLib:Event.h"
  5. #include "DeskLib:Icon.h"
  6.  
  7.  
  8. extern void Icon_ClickWait(int waittime)
  9. {
  10.   static int      waitingonclick = FALSE;
  11.   int             time;
  12.   event_pollblock event;
  13.   event_pollmask  mask;
  14.  
  15.   if (waitingonclick)        /* Don't allow re-entrant call on this function */
  16.     return;
  17.  
  18.   waitingonclick = TRUE;
  19.   time = Time_Monotonic() + waittime;
  20.  
  21.   do
  22.   {
  23.     mask.value = 0;                           /* enable null polls */
  24.     Wimp_PollIdle(mask, &event, time);        /* Wait until time up or event */
  25.  
  26.     if (event.type != event_CLICK && event.type != event_NULL)
  27.       Event_Process(&event);                           /* Process this event */
  28.  
  29.   } while (event.type == event_CLICK || event.type == event_REDRAW);
  30.  
  31.   /*  Wait until not a button click event, and also ignore redraws as a
  32.    *  termination condition, as redraw is very likely (indenting a button)
  33.    *  on the first poll after the click which called us!
  34.    */
  35.  
  36.   waitingonclick = FALSE;
  37. }
  38.